<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <!-- <meta http-equiv="X-Frame-Options" content="ALLOW-FROM"> -->
    <title>查看收货地址</title>
    <link href="./image/favicon.ico" rel="shortcut icon">
    <link rel="stylesheet" href="./lib/css/jquery-weui.min.css" />
    <link rel="stylesheet" href="./style/base.css" />
    <link rel="stylesheet" href="./style/layer.css" />
</head>

<body>
    <div class="fixed bg2"></div>
    <div class="content_jgg">
        <div class="content address-content">
            <div class="container">
                <div class="form-item">
                    <label>姓名</label>
                    <div>
                        <input data-code="receiverName" type="text" id="name">
                    </div>
                </div>
                <div class="form-item">
                    <label>联系电话</label>
                    <div>
                        <input data-code="receiverPhone" type="tel" id="tel">
                    </div>
                </div>
                <div class="form-item">
                    <label>地址</label>
                    <div class="">
                        <input class="input-pch" data-code="city" type="text" placeholder="请选择城市" id="city">
                    </div>
                </div>
                <div class="form-item">
                    <label>门牌号</label>
                    <div>
                        <input data-code="detailAddress" type="text" id="address">
                    </div>
                </div>
                <div class="form-item t-c">
                    <button class="gradient-bg" id="submit">返回直播</button>
                </div>
            </div>
        </div>
    </div>
    <div class="loading-bar"> </div>
    <!-- <script type="text/javascript" src="./js/jquery.min.js"></script> -->
    <script type="text/javascript" src="./lib/js/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/js/jquery-weui.min.js"></script>
    <script>
        function loading(isOpen) {
            $('.loading-bar')[isOpen ? 'removeClass' : 'addClass']('hidden');
        }
        loading(1);
    </script>
    <script type="text/javascript" src="./lib/js/city_new.min.js"></script>
    <script type="text/javascript" src="./lib/js/cityPicker.js"></script>
    <!-- <script type="text/javascript" src="./js/common.js?v=20180719"></script> -->
    <script type="text/javascript" src="./js/layer.m.js"></script>
    <script>
        var info = JSON.parse(localStorage.getItem('isLogin') || '{}');
        var urlSplit = window.location.href.split("/");
        var common = {
            prize: {},
            urlPage: 'http://127.0.0.1:5500/static',
            // url: 'http://192.168.14.188:8090',
            url: window.location.protocol + "//" + window.location.host + "/" + urlSplit[3] + "/" + urlSplit[4],
            skipUrl: 'https://live.polyv.cn/watch/239952',
        };
        $(function () {
            loading();
            $('input').prop('disabled', true);

            function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = decodeURI(window.location.search).substr(1).match(reg);
            if (r != null) return r[2];
            return null;
            }
            // getAddress(function (data) {
            //     loading();
            //     if(data.code == 0) {
            //         if (Array.isArray(data.content)) {
            //             $('input[data-code="receiverName"]').val(data.content[0].receiverName);
            //             $('input[data-code="receiverPhone"]').val(data.content[0].receiverPhone);
            //             $('input[data-code="city"]').val(getCity(data.content[0]));
            //             $('input[data-code="detailAddress"]').val(data.content[0].detailAddress);
            //         }
            //     }
            // });

            var url = window.location.href;

            $('input[data-code="receiverName"]').val(getQueryString("receiverName"));
            $('input[data-code="receiverPhone"]').val(getQueryString("receiverPhone"));
            $('input[data-code="city"]').val(getCity({
                cityCode: getQueryString("cityCode"),
                townCode: getQueryString("townCode"),
                provinceCode: getQueryString("provinceCode"),
            }));
            $('input[data-code="detailAddress"]').val(getQueryString("detailAddress"));
        })

        function getCity(data) {
            var a = b = c = '';
            $.each(window.cityData, function (i, province) {
                if (province.code === data.provinceCode) {
                    a = province.name + ' ';
                    $.each(province.sub, function (i, city) {
                        if (city.code === data.cityCode) {
                            b = city.name + ' ';
                            $.each(city.sub, function (i, town) {
                                if (town.code === data.townCode) {
                                    c = town.name + ' ';
                                }
                            })
                        }
                    })
                }
            })
            return a + b + c;
        }

        function getAddress(cb) {
            var t = +new Date();
            var urlSplit = window.location.href.split("/");
            $.ajax({
                url: common.url + '/auldraw/address/' + JSON.parse(localStorage.getItem("isLogin")).staffNum,
                // url: window.location.protocol + "//" + window.location.host + "/" + urlSplit[3] + "/" + urlSplit[4] + '/auldraw/address/' + JSON.parse(localStorage.getItem("isLogin")).staffNum,
                type: 'GET',
                beforeSend: function () {
                    loading(1);
                },
                complete: function () {
                    loading();
                },
                success: function (data) {
                    if (data) {
                        cb(data);
                    }
                },

            })
        }

        $('#submit').on('click', function (e) {
            location.href = common.skipUrl;
        })
    </script>
    <style>
        #cnzz_stat_icon_1275024165 {
            display: none;
        }
    </style>
    <script type="text/javascript">
        var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
        document.write(unescape("%3Cspan id='cnzz_stat_icon_1275024165'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol +
            "s19.cnzz.com/z_stat.php%3Fid%3D1275024165' type='text/javascript'%3E%3C/script%3E"));
    </script>
</body>

</html>